
//
//  Double_Ext.swift
//  SwiftDeveloper
//
//  Created by 李爽 on 15/11/13.
//  Copyright (c) 2015年 Shawn Li. All rights reserved.
//

import Foundation

//给Double增加mm，cm等方法，进行进制转换
//use: let value = 2000000000.0 print(value.mm()) print(value.cm()) print(value.dm()) print(value.m()) print(value.km())
extension Double
{
    func mm()->String
    {
        return "\(self/1)mm"
    }
    
    func cm()-> String
    {
        return "\(self/10)cm"
    }
    
    func dm()->String{
        return "\(self/100)dm"
    }
    
    func m()->String
    {
        return "\(self/1000)m"
    }
    
    func km()->String
    {
        return "\(self/(1000*1000))km"
    }
}